package choreganizer;

/*
* Enumerations of types of scheduling
* used in the dates
*/
public class ScheduleTypes
{

	/*
	* annual			- every x yeas [range: any positive number]
	* specific		- only on x years [range: any valid year]
	*/
	public enum YearTypes {
		specific,
		annual
	}

	
	/*
	* annual			- every x months [range: 1-24]
	* specific		- only on x months [range: 0-11]
	* unspecified	- not used. must use DayType.annual
	*/
	public enum MonthTypes {
		specific,
		annual,
		unspecified
	}

	
	/*
	* annual			- every x days [range: 1-30]
	* specific		- only on x days of the week [range: sunday-saturday]
	* calendardays - only on x days of the month [range: 1-31]
	*/
	public enum DayTypes {
		specific,
		annual,
		calendardays
	}
	
	
	/*
	* annual			- every x minues [range: 1 - 1440]
	* specific		- only at x hour [range: 00:00 - 24:00]
	*/
	public enum TimeTypes {
		specific,
		annual
	}
	
	
	/*
	* none			- No alert
	* silentPopup	- A popup will trigger
	* sound			- A sound will trigger
	* soundPopup	- A sound and popup will trigger
	*/
	public enum AlertTypes {
		none,
		silentPopup,
		sound,
		soundPopup
	}
	
	
	
	
	
	public static YearTypes[] AllYearTypes()
	{
		YearTypes[] all = {
			YearTypes.annual,
			YearTypes.specific
		};
		
		return all;
	}
	
	public static MonthTypes[] AllMonthTypes()
	{
		MonthTypes[] all = {
			MonthTypes.annual,
			MonthTypes.specific,
			MonthTypes.unspecified
		};
		
		return all;
	}
	
	public static DayTypes[] AllDayTypes()
	{
		DayTypes[] all = {
			DayTypes.annual,
			DayTypes.specific,
			DayTypes.calendardays
		};
		
		return all;
	}
	
	public static TimeTypes[] AllTimeTypes()
	{
		TimeTypes[] all = {
			TimeTypes.annual,
			TimeTypes.specific
		};
		
		return all;
	}
	
	public static AlertTypes[] AllAlertTypes()
	{
		AlertTypes[] all = {
			AlertTypes.none,
			AlertTypes.silentPopup,
			AlertTypes.sound,
			AlertTypes.soundPopup
		};
		
		return all;
	}
	
	
	
	

	/*
	* Accessor method to convert a string to a YearTypes enum
	*/
	public static YearTypes YearToType(String s)
	{
		YearTypes yearType = null;
		
		if (s.equals("annual"))
			yearType = YearTypes.annual;
		else if (s.equals("specific"))
			yearType = YearTypes.specific;
		
		return yearType;
	}

	
	/*
	* Accessor method to convert a string to a MonthTypes enum
	*/
	public static MonthTypes MonthToType(String s)
	{
		MonthTypes monthType = null;
		
		if (s.equals("unspecified"))
			monthType = MonthTypes.unspecified;
		else if (s.equals("annual"))	
			monthType = MonthTypes.annual;
		else if (s.equals("specific"))
			monthType = MonthTypes.specific;
		
		return monthType;
	}
	
	
	/*
	* Accessor method to convert a string to a DayTypes enum
	*/
	public static DayTypes DayToType(String s)
	{
		DayTypes dayType = null;
		
		if (s.equals("calendardays"))
			dayType = DayTypes.calendardays;
		else if (s.equals("annual"))
			dayType = DayTypes.annual;
		else if (s.equals("specific"))
			dayType = DayTypes.specific;
		
		return dayType;
	}
	
	
	/*
	* Accessor method to convert a string to a TimeTypes enum
	*/
	public static TimeTypes TimeToType(String s)
	{
		TimeTypes timeType = null;
		
		if (s.equals("annual"))
			timeType = TimeTypes.annual;
		else if (s.equals("specific"))
			timeType = TimeTypes.specific;
		
		return timeType;
	}
	
	
	/*
	* Accessor method to convert a string to a AlertTypes enum
	*/
	public static AlertTypes AlertToType(String s)
	{
		AlertTypes alertType = null;
		
		if (s.equals("none"))
			alertType = AlertTypes.none;
		else if (s.equals("silentPopup"))
			alertType = AlertTypes.silentPopup;
		else if (s.equals("sound"))
			alertType = AlertTypes.sound;
		else if (s.equals("soundPopup"))
			alertType = AlertTypes.soundPopup;
		
		return alertType;
	}
	
}
